<?php Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/user/user.css'); ?>
<div class="form">

   <?php
   $form = $this->beginWidget('CActiveForm', array(
       'id' => 'user-form',
       'enableAjaxValidation' => false,
       'htmlOptions' => array('enctype' => 'multipart/form-data',),));
   ?>

   <p class="note">Fields with <span class="required">*</span> are required.</p>

      <?php echo $form->errorSummary($model); ?>

   <div class="row">
      <?php echo $form->labelEx($model, 'first_name'); ?>
<?php echo $form->textField($model, 'first_name', array('size' => 60, 'maxlength' => 255)); ?>
<?php echo $form->error($model, 'first_name'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'middle_name'); ?>
<?php echo $form->textField($model, 'middle_name', array('size' => 60, 'maxlength' => 255)); ?>
<?php echo $form->error($model, 'middle_name'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'last_name'); ?>
<?php echo $form->textField($model, 'last_name', array('size' => 60, 'maxlength' => 255)); ?>
<?php echo $form->error($model, 'last_name'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'username'); ?>
   <?php echo $form->textField($model, 'username', array('size' => 30, 'maxlength' => 30)); ?>
   <?php echo $form->error($model, 'username'); ?>
   </div>
      <?php if ($model->isNewRecord) { ?>
      <div class="row">
         <?php echo $form->labelEx($model, 'password'); ?>
      <?php echo $form->passwordField($model, 'password', array('size' => 60, 'maxlength' => 255)); ?>
      <?php echo $form->error($model, 'password'); ?>
      </div>
      <?php } ?>
   <div class="row">
      <?php echo $form->labelEx($model, 'email'); ?>
<?php echo $form->textField($model, 'email', array('size' => 60, 'maxlength' => 255)); ?>
<?php echo $form->error($model, 'email'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'picture'); ?>
<?php echo CHtml::activeFileField($model, 'picture'); ?> 
   <?php echo $form->error($model, 'picture'); ?>
   </div>

      <?php if ($model->isNewRecord != '1') { ?>
      <div class="row">
      <?php echo CHtml::image(($model->picture) ? Yii::app()->getBaseUrl(true) . DIRECTORY_SEPARATOR . Yii::app()->params['imageSavePath'] . $model->picture : Yii::app()->getBaseUrl(true) . DIRECTORY_SEPARATOR . Yii::app()->params['imageSavePath'] . 'default.jpg', "image", array("width" => 128)); ?> 
      </div>
      <?php } ?>

   <div class="row">
      <?php echo $form->labelEx($model, 'birthday'); ?>
      <?php
      $this->widget('zii.widgets.jui.CJuiDatePicker', array(
          'value' => $model->birthday,
          'name' => Chtml::activeName($model, 'birthday'),
          'id' => Chtml::activeId($model, 'birthday'),
          'options' => array(
              'showAnim' => 'fold',
              'dateFormat' => 'yy-mm-dd',
          ),
          'htmlOptions' => array(
              'style' => 'height:20px;'
          ),));
      ?>

      <?php echo $form->error($model, 'birthday'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'country'); ?>
      <?php
      $this->widget('ext.countrySelectorWidget', array(
          'value' => $model->country,
          'name' => Chtml::activeName($model, 'country'),
          'id' => Chtml::activeId($model, 'country'),
          'useCountryCode' => false,
          'defaultValue' => 'Sri Lanka',
          'firstEmpty' => false,
      ));
      ?>
      <?php echo $form->error($model, 'country'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'address'); ?>
      <?php echo $form->textArea($model, 'address', array('rows' => 6, 'cols' => 50)); ?>
      <?php echo $form->error($model, 'address'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'address2'); ?>
      <?php echo $form->textArea($model, 'address2', array('rows' => 6, 'cols' => 50)); ?>
      <?php echo $form->error($model, 'address2'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'tele'); ?>
      <?php echo $form->textField($model, 'tele', array('size' => 20, 'maxlength' => 20)); ?>
      <?php echo $form->error($model, 'tele'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'fax'); ?>
      <?php echo $form->textField($model, 'fax', array('size' => 20, 'maxlength' => 20)); ?>
      <?php echo $form->error($model, 'fax'); ?>
   </div>

   <div class="row">
      <?php echo $form->labelEx($model, 'web'); ?>
<?php echo $form->textField($model, 'web', array('rows' => 6, 'cols' => 50)); ?>
   <?php echo $form->error($model, 'web'); ?>
   </div>

   <div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
   </div>

<?php $this->endWidget(); ?>

</div><!-- form -->